package com.example.recyclerview;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        intView();
    }
    public void intView(){
        RecyclerView recy=findViewById(R.id.recy_icon);
        GridLayoutManager glm=new GridLayoutManager(this,4,
                GridLayoutManager.VERTICAL,false) ;
        recy.setLayoutManager(glm);
        List<RecyBean> data=new ArrayList<>();
            RecyBean bean=new RecyBean();
//            String[] name=new String[]{"收付款","钱包","信用卡还款","理财通","手机充值","生活缴费","Q币充值",
//            "城市服务","腾讯公益","医疗健康","防疫健康码","出行服务","火车票机票","滴滴出行","酒店"};
//            int[] img=new int[]{R.mipmap.shoufukuan,R.mipmap.you,R.mipmap.huankuai,R.mipmap.licaitong,
//                    R.mipmap.shoujichongzhi,R.mipmap.shenghuojifei,R.mipmap.qq,R.mipmap.chengshi,
//                    R.mipmap.gongyi,R.mipmap.yiliaojiankang,R.mipmap.jiankangma,R.mipmap.chuxing,R.mipmap.huochepiao,
//                    R.mipmap.didi,R.mipmap.jiudian};
            bean.setRecyname("收付款");
            bean.setRecyid(R.mipmap.shoufukuan);
            data.add(bean);
        RecyBean bean1=new RecyBean();
            bean1.setRecyname("钱包");
            bean1.setRecyid(R.mipmap.you);
            data.add(bean1);
        RecyBean bean17=new RecyBean();
        bean17.setRecyname("");
        bean17.setRecyid(0);
        data.add(bean17);
        RecyBean bean18=new RecyBean();
        bean18.setRecyname("");
        bean18.setRecyid(0);
        data.add(bean18);

        RecyBean bean2=new RecyBean();
            bean2.setRecyname("信用卡还款");
            bean2.setRecyid(R.mipmap.huankuai);
        data.add(bean2);
        RecyBean bean3=new RecyBean();
            bean3.setRecyname("理财通");
            bean3.setRecyid(R.mipmap.licaitong);
            data.add(bean3);
        RecyBean bean4=new RecyBean();
            bean4.setRecyname("");
            bean4.setRecyid(0);
            data.add(bean4);
        RecyBean bean5=new RecyBean();
            bean5.setRecyname("");
            bean5.setRecyid(0);
            data.add(bean5);
        RecyBean bean6=new RecyBean();
            bean6.setRecyname("手机充值");
            bean6.setRecyid(R.mipmap.shoujichongzhi);
            data.add(bean6);
        RecyBean bean7=new RecyBean();
            bean7.setRecyname("生活缴费");
            bean7.setRecyid(R.mipmap.shenghuojifei);
        data.add(bean7);
        RecyBean bean8=new RecyBean();
            bean8.setRecyname("Q币充值");
            bean8.setRecyid(R.mipmap.qq);
        data.add(bean8);
        RecyBean bean9=new RecyBean();
            bean9.setRecyname("城市服务");
            bean9.setRecyid(R.mipmap.chengshi);
        data.add(bean9);
        RecyBean bean10=new RecyBean();
            bean10.setRecyname("腾讯公益");
            bean10.setRecyid(R.mipmap.gongyi);
        data.add(bean10);
        RecyBean bean11=new RecyBean();
            bean11.setRecyname("医疗健康");
            bean11.setRecyid(R.mipmap.yiliaojiankang);
        data.add(bean11);
        RecyBean bean12=new RecyBean();
            bean12.setRecyname("防疫健康码");
            bean12.setRecyid(R.mipmap.jiankangma);
        data.add(bean12);
        RecyBean bean13=new RecyBean();
            bean13.setRecyname("出行服务");
            bean13.setRecyid(R.mipmap.chuxing);
        data.add(bean13);
        RecyBean bean14=new RecyBean();
            bean14.setRecyname("火车票机票");
            bean14.setRecyid(R.mipmap.huochepiao);
        data.add(bean14);
        RecyBean bean15=new RecyBean();
            bean15.setRecyname("滴滴出行");
            bean15.setRecyid(R.mipmap.didi);
        data.add(bean15);
        RecyBean bean16=new RecyBean();
            bean16.setRecyname("酒店");
            bean16.setRecyid(R.mipmap.jiudian);
        data.add(bean16);

        MyAdaper adaper=new MyAdaper(MainActivity.this);
        adaper.setList(data);

        recy.setAdapter(adaper);

    }
}